package org.csc.api.controller;

import org.csc.api.feign.ApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author caochong
 * @date 2019/03/13
 */
@RestController
@RequestMapping("public")
@RefreshScope
public class PublicController {

    @Autowired
    private ApiService apiService;

    @Value("${test.name}")
    private String name;
    @Value("${test.version}")
    private String version;

    @RequestMapping("test")
    public String test() {
        return "api 项目";
    }

    @RequestMapping("api2")
    public String api2() {
        return apiService.apiTest();
    }

    @RequestMapping("config")
    public String config() {
        return "name=" + name + "----version="  + version;
    }
}
